import Vue from 'vue'
import Vuex from 'vuex'
import { APP_TITLE_EN } from '@/env.js' 
import createPersistedstate from 'vuex-persistedstate'
import modules from './modules/index.js' 
 
Vue.use(Vuex) 
 
const persistedState = createPersistedstate({
  storage: {
    getItem: key => uni.getStorageSync(key), 
    setItem: (key, value) => uni.setStorageSync(key,  value),
    removeItem: key => uni.removeStorageSync(key) 
  },
  key: `${APP_TITLE_EN}-vuex`
  // paths: ['user']
})
 
export default new Vuex.Store({
  plugins: [persistedState],
  modules 
})